Exits my question and the question already asked and is different from them. I think imagine that I have a There is a minimum dataset (bird) where each row shows the bird's observation at a given time and place: id, obs, country A, 4, United States of America, B, 3, Can A, 5, United States C, 4, MEX C, 1, USA A, 3, Can D, 1, Blank What do I ideally prefer Conversion of a dataset, removing the tap from a dataset like this: id, tot_obs, country_tot A, 12,2 b, 3,1c, 5,2 I know that I can get by using the number of factors: table (bird $ country) However, Is there a clever, perhaps, a way to remove the tap, connecting the total numbers, finding the numbers of countries and then reconfiguring them in this form? If there is a package that does this, then I am also open for that suggestion! Load the data with stringsacters = FALSE : df All Rows to country = null df plyr package abbreviation to get the desired code: / P> ddply (df, (id), su...